import Vue from 'vue'
import Vuex from 'vuex';


Vue.use(Vuex);

let store=new Vuex.Store({
    state:{
        pInit: false,
        userName: '' || localStorage.getItem("userName"),
        password: '' || localStorage.getItem("password"),
    },
    getters: {
        pInit: (state) => state.pInit || localStorage.getItem("pInit"),
        userName: (state) => state.userName || localStorage.getItem("userName"),
        password: (state) => state.password || localStorage.getItem("password"),
    },
    mutations:{
        SET_PSW_INIT: (state, pInit) => {
            localStorage.pInit = pInit;
            state.pInit = pInit
        },
        SET_USER_NAME: (state, userName) => {
            localStorage.userName = state.userName;
            state.userName = userName
        },
        SET_PSWD: (state, password) => {
            localStorage.password = password;
            state.password = password
        },
    },
    modules:{

    }
});

export default store;